<template>
    <div class="content electronic-detail">
        <div class="btns-tools">
            <Button size="small" @click="backList">返回列表</Button>
            <Button size="small" type="primary">发起委托申请</Button>
            <Button size="small" type="primary">签订委托协议</Button>
        </div>
        <BaseInfo v-model="form" />
        <RegisterInfo v-model="form" />
        <CustomerInfo v-model="form.declarerList" />
    </div>
</template>
<script>
import { queryElectById } from '@/api/basicData'
import BaseInfo from './components/base-info'
import RegisterInfo from './components/register-info'
import CustomerInfo from './components/customer-info'
import { mapMutations } from 'vuex'

export default {
    components: {
        BaseInfo,
        RegisterInfo,
        CustomerInfo
    },
    data () {
        return {
            form: {
                declarerList: []
            }
        }
    },
    mounted () {
        const id = this.$route.params.id
        id && this.queryInfo(id)
    },
    methods: {
        ...mapMutations(['removeTagNav']),
        queryInfo (id) {
            queryElectById(id).then(res => {
                if (res.data.success) {
                    const data = res.data.data
                    this.form = data
                }
            })
        },
        backList () {
            this.removeTagNav(this.$route)
            this.$router.replace({
                name: 'electronic'
            })
        }
    }
}
</script>
<style lang="less">
.electronic-detail {
    .btns-tools {
        margin-bottom: 15px;
        button + button {
            margin-left: 10px;
        }
    }
    .declare-form {
        .ivu-form-item {
            width: 33.33%;
            display: inline-block;
            margin-bottom: -1px;
        }
        .span-16 {
            width: 66.66%;
        }
        .span-24 {
            width: 100%;
        }
    }
    .electronic-form-block {
        margin-bottom: 15px;
    }
    .electronic-title {
        font-size: 14px;
        font-weight: 700;
        margin-bottom: 15px;
    }
}

</style>
